// 定义 RestfulApi.Models 命名空间
using System.ComponentModel.DataAnnotations;

namespace RestfulApi.Models
{
    // 颜色实体类，用于表示颜色信息
    public class Color
    {
        // 颜色唯一标识符
        [Required]
        public int Id { get; set; }

        // 颜色名称，默认为空字符串
        [StringLength(20)]
        public string Name { get; set; } = string.Empty;

        // 颜色十六进制代码，默认为空字符串
        [StringLength(7)]
        [RegularExpression(@"^#([A-Fa-f0-9]{6})$", ErrorMessage = "颜色代码必须是有效的十六进制格式，例如 #FF0000")]
        public string HexCode { get; set; } = string.Empty;

        // 颜色RGB值
        public RgbValue RgbValue { get; set; } = new RgbValue();

        // 颜色分类
        public ColorCategory Category { get; set; } = new ColorCategory();
        
        // 颜色元数据 - 嵌套3层以上的数据模型
        public ColorMetadata Metadata { get; set; } = new ColorMetadata();
    }

    // RGB颜色值类，嵌套参数示例
    public class RgbValue
    {
        [Range(0, 255)]
        public int Red { get; set; }

        [Range(0, 255)]
        public int Green { get; set; }

        [Range(0, 255)]
        public int Blue { get; set; }
    }

    // 颜色分类类，嵌套参数示例
    public class ColorCategory
    {
        public int Id { get; set; }

        [StringLength(20)]
        public string Name { get; set; } = string.Empty;

        [StringLength(100)]
        public string Description { get; set; } = string.Empty;
    }

    // 颜色过滤器，用于查询颜色
    public class ColorFilter
    {
        public string? Name { get; set; }
        public string? CategoryName { get; set; }
        public bool? IsDarkColor { get; set; }
    }

    // 颜色批量操作请求
    public class ColorBatchRequest
    {
        public List<Color> Colors { get; set; } = new List<Color>();
        public string Operation { get; set; } = string.Empty;
    }
    
    // 颜色元数据 - 第1层嵌套
    public class ColorMetadata
    {
        public DateTime CreatedAt { get; set; } = DateTime.Now;
        public string CreatedBy { get; set; } = string.Empty;
        public ColorUsage Usage { get; set; } = new ColorUsage();
        public ColorTrend Trend { get; set; } = new ColorTrend();
    }
    
    // 颜色使用情况 - 第2层嵌套
    public class ColorUsage
    {
        public int UsageCount { get; set; }
        public List<string> Applications { get; set; } = new List<string>();
        public ColorIndustry Industry { get; set; } = new ColorIndustry();
    }
    
    // 颜色行业信息 - 第3层嵌套
    public class ColorIndustry
    {
        public string IndustryName { get; set; } = string.Empty;
        public double Popularity { get; set; }
        public ColorIndustryDetails Details { get; set; } = new ColorIndustryDetails();
    }
    
    // 颜色行业详情 - 第4层嵌套
    public class ColorIndustryDetails
    {
        public int Year { get; set; }
        public string Season { get; set; } = string.Empty;
        public List<ColorHistoricalData> HistoricalData { get; set; } = new List<ColorHistoricalData>();
    }
    
    // 颜色历史数据 - 第5层嵌套
    public class ColorHistoricalData
    {
        public int Year { get; set; }
        public double MarketShare { get; set; }
        public string Trend { get; set; } = string.Empty;
    }
    
    // 颜色趋势 - 第2层嵌套（另一个分支）
    public class ColorTrend
    {
        public string CurrentTrend { get; set; } = string.Empty;
        public double GrowthRate { get; set; }
        public ColorForecast Forecast { get; set; } = new ColorForecast();
    }
    
    // 颜色预测 - 第3层嵌套
    public class ColorForecast
    {
        public int NextYear { get; set; }
        public double PredictedPopularity { get; set; }
        public ColorMarketAnalysis MarketAnalysis { get; set; } = new ColorMarketAnalysis();
    }
    
    // 颜色市场分析 - 第4层嵌套
    public class ColorMarketAnalysis
    {
        public List<string> EmergingMarkets { get; set; } = new List<string>();
        public List<string> DecliningMarkets { get; set; } = new List<string>();
        public ColorCompetitorAnalysis CompetitorAnalysis { get; set; } = new ColorCompetitorAnalysis();
    }
    
    // 颜色竞争对手分析 - 第5层嵌套
    public class ColorCompetitorAnalysis
    {
        public List<string> MainCompetitors { get; set; } = new List<string>();
        public string StrategicAdvice { get; set; } = string.Empty;
    }
}